// src/main/java/com/nb/vo/DeptTreeVO.java
package com.nb.vo;

import com.nb.entity.Dept;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;

/**
 * 部门树VO
 */
@Data
public class DeptTreeVO {
    private Long id;
    private String name;
    private Long parentId;
    private String level;
    private Integer sort;
    private List<DeptTreeVO> children = new ArrayList<>();

    /**
     * 从Dept实体转换为树VO
     */
    public static DeptTreeVO fromDept(Dept dept) {
        DeptTreeVO vo = new DeptTreeVO();
        vo.setId(dept.getId());
        vo.setName(dept.getName());
        vo.setParentId(dept.getParentId());
        vo.setLevel(dept.getLevel());
        vo.setSort(dept.getSort());
        return vo;
    }
}